

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>CephFS Shell &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
      <li>CephFS Shell</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/cephfs/cephfs-shell.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul>
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="cephfs-shell">
<h1>CephFS Shell<a class="headerlink" href="#cephfs-shell" title="Permalink to this headline">¶</a></h1>
<p>CephFS Shell 包含各种类似 shell 的命令，可以直接与
<a class="reference internal" href="../../glossary/#term-18"><span class="xref std std-term">Ceph 文件系统</span></a>交互。</p>
<p>This tool can be used in interactive mode as well as in non-interactive mode.
In former mode, cephfs-shell opens a shell session and after the given command
is finished, it prints the prompt string and waits indefinitely. When the
shell session is finished, cephfs-shell quits with the return value of last
executed command. In non-interactive mode, cephfs-shell issues a command and
exits right after the command’s execution is complete with the command’s return
value.</p>
<p>Behaviour of CephFS Shell can be tweaked using cephfs-shell.conf. CephFS Shell
looks for it by default at the path provided in environment variable
<cite>CEPHFS_SHELL_CONF</cite> and then in user’s home directory
(<cite>~/.cephfs-shell.conf</cite>).</p>
<p>用法：</p>
<blockquote>
<div><p>cephfs-shell [options] [command]
cephfs-shell [options] – [command, command,…]</p>
</div></blockquote>
<p>选项：</p>
<blockquote>
<div><dl class="option-list">
<dt><kbd><span class="option">-c</span>, <span class="option">--config <var>FILE</var></span></kbd></dt>
<dd><p>配置文件 cephfs-shell.conf 的路径</p>
</dd>
<dt><kbd><span class="option">-b</span>, <span class="option">--batch <var>FILE</var></span></kbd></dt>
<dd><p>批处理文件的路径</p>
</dd>
<dt><kbd><span class="option">-t</span>, <span class="option">--test <var>FILE</var></span></kbd></dt>
<dd><p>Path to transcript(s) in FILE for testing</p>
</dd>
</dl>
</div></blockquote>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Latest version of the cmd2 module is required for running cephfs-shell.
If CephFS is installed through source, execute cephfs-shell in the build
directory. It can also be executed as following using virtualenv:</p>
</div>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="o">[</span>build<span class="o">]</span>$ virtualenv -p python3 venv <span class="o">&amp;&amp;</span> <span class="nb">source</span> venv/bin/activate <span class="o">&amp;&amp;</span> pip3 install cmd2
<span class="o">[</span>build<span class="o">]</span>$ <span class="nb">source</span> vstart_environment.sh <span class="o">&amp;&amp;</span> <span class="nb">source</span> venv/bin/activate <span class="o">&amp;&amp;</span> python3 ../src/tools/cephfs/cephfs-shell
</pre></div>
</div>
<div class="section" id="id1">
<h2>命令<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<div class="section" id="mkdir">
<h3>mkdir<a class="headerlink" href="#mkdir" title="Permalink to this headline">¶</a></h3>
<p>Create the directory(ies), if they do not already exist.</p>
<p>用法：</p>
<blockquote>
<div><p>mkdir [-option] &lt;directory&gt;…</p>
</div></blockquote>
<ul class="simple">
<li><p>directory - name of the directory to be created.</p></li>
</ul>
<dl>
<dt>选项：</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-m <var>MODE</var></span></kbd></dt>
<dd><p>Sets the access mode for the new directory.</p>
</dd>
<dt><kbd><span class="option">-p</span>, <span class="option">--parent</span></kbd></dt>
<dd><p>Create parent directories as necessary. When this option is specified, no error is reported if a directory already exists.</p>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="put">
<h3>put<a class="headerlink" href="#put" title="Permalink to this headline">¶</a></h3>
<p>Copy a file/directory to Ceph File System from Local File System.</p>
<p>用法：</p>
<blockquote>
<div><p>put [options] &lt;source_path&gt; [target_path]</p>
</div></blockquote>
<ul class="simple">
<li><dl class="simple">
<dt>source_path - local file/directory path to be copied to cephfs.</dt><dd><ul>
<li><p>if <cite>.</cite> copies all the file/directories in the local working directory.</p></li>
<li><p>if <cite>-</cite>  Reads the input from stdin.</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>target_path - remote directory path where the files/directories are to be copied to.</dt><dd><ul>
<li><p>if <cite>.</cite> files/directories are copied to the remote working directory.</p></li>
</ul>
</dd>
</dl>
</li>
</ul>
<dl>
<dt>选项：</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-f</span>, <span class="option">--force</span></kbd></dt>
<dd><p>Overwrites the destination if it already exists.</p>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="get">
<h3>get<a class="headerlink" href="#get" title="Permalink to this headline">¶</a></h3>
<p>Copy a file from Ceph File System to Local File System.</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">get</span> <span class="p">[</span><span class="n">options</span><span class="p">]</span> <span class="o">&lt;</span><span class="n">source_path</span><span class="o">&gt;</span> <span class="p">[</span><span class="n">target_path</span><span class="p">]</span>
</pre></div>
</div>
<ul class="simple">
<li><dl class="simple">
<dt>source_path - remote file/directory path which is to be copied to local file system.</dt><dd><ul>
<li><p>if <cite>.</cite> copies all the file/directories in the remote working directory.</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>target_path - local directory path where the files/directories are to be copied to.</dt><dd><ul>
<li><p>if <cite>.</cite> files/directories are copied to the local working directory.</p></li>
<li><p>if <cite>-</cite> Writes output to stdout.</p></li>
</ul>
</dd>
</dl>
</li>
</ul>
<dl>
<dt>选项：</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-f</span>, <span class="option">--force</span></kbd></dt>
<dd><p>Overwrites the destination if it already exists.</p>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="ls">
<h3>ls<a class="headerlink" href="#ls" title="Permalink to this headline">¶</a></h3>
<p>List all the files and directories in the current working directory.</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ls</span> <span class="p">[</span><span class="n">option</span><span class="p">]</span> <span class="p">[</span><span class="n">directory</span><span class="p">]</span><span class="o">...</span>
</pre></div>
</div>
<ul class="simple">
<li><dl class="simple">
<dt>directory - name of directory whose files/directories are to be listed.</dt><dd><ul>
<li><p>By default current working directory’s files/directories are listed.</p></li>
</ul>
</dd>
</dl>
</li>
</ul>
<dl>
<dt>选项：</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-l</span>, <span class="option">--long</span></kbd></dt>
<dd><p>list with long format - show permissions</p>
</dd>
<dt><kbd><span class="option">-r</span>, <span class="option">--reverse</span></kbd></dt>
<dd><p>reverse sort</p>
</dd>
<dt><kbd><span class="option">-H</span></kbd></dt>
<dd><p>human readable</p>
</dd>
<dt><kbd><span class="option">-a</span>, <span class="option">-a<var>ll</var></span></kbd></dt>
<dd><p>ignore entries starting with .</p>
</dd>
<dt><kbd><span class="option">-S</span></kbd></dt>
<dd><p>Sort by file_size</p>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="cat">
<h3>cat<a class="headerlink" href="#cat" title="Permalink to this headline">¶</a></h3>
<p>Concatenate files and print on the standard output</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cat</span>  <span class="o">&lt;</span><span class="n">file</span><span class="o">&gt;....</span>
</pre></div>
</div>
<ul class="simple">
<li><p>file - name of the file</p></li>
</ul>
</div>
<div class="section" id="cd">
<h3>cd<a class="headerlink" href="#cd" title="Permalink to this headline">¶</a></h3>
<p>Change current working directory.</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="p">[</span><span class="n">directory</span><span class="p">]</span>
</pre></div>
</div>
<ul class="simple">
<li><dl class="simple">
<dt>directory - path/directory name. If no directory is mentioned it is changed to the root directory.</dt><dd><ul>
<li><p>If ‘.’ moves to the parent directory of the current directory.</p></li>
</ul>
</dd>
</dl>
</li>
</ul>
</div>
<div class="section" id="cwd">
<h3>cwd<a class="headerlink" href="#cwd" title="Permalink to this headline">¶</a></h3>
<p>Get current working directory.</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cwd</span>
</pre></div>
</div>
</div>
<div class="section" id="quit-ctrl-d">
<h3>quit/Ctrl + D<a class="headerlink" href="#quit-ctrl-d" title="Permalink to this headline">¶</a></h3>
<p>Close the shell.</p>
</div>
<div class="section" id="chmod">
<h3>chmod<a class="headerlink" href="#chmod" title="Permalink to this headline">¶</a></h3>
<p>Change the permissions of file/directory.</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">chmod</span> <span class="o">&lt;</span><span class="n">mode</span><span class="o">&gt;</span> <span class="o">&lt;</span><span class="n">file</span><span class="o">/</span><span class="n">directory</span><span class="o">&gt;</span>
</pre></div>
</div>
</div>
<div class="section" id="mv">
<h3>mv<a class="headerlink" href="#mv" title="Permalink to this headline">¶</a></h3>
<p>Moves files/Directory from source to destination.</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mv</span> <span class="o">&lt;</span><span class="n">source_path</span><span class="o">&gt;</span> <span class="o">&lt;</span><span class="n">destination_path</span><span class="o">&gt;</span>
</pre></div>
</div>
</div>
<div class="section" id="rmdir">
<h3>rmdir<a class="headerlink" href="#rmdir" title="Permalink to this headline">¶</a></h3>
<p>Delete a directory(ies).</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rmdir</span> <span class="o">&lt;</span><span class="n">directory_name</span><span class="o">&gt;.....</span>
</pre></div>
</div>
</div>
<div class="section" id="rm">
<h3>rm<a class="headerlink" href="#rm" title="Permalink to this headline">¶</a></h3>
<p>Remove a file(es).</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rm</span> <span class="o">&lt;</span><span class="n">file_name</span><span class="o">/</span><span class="n">pattern</span><span class="o">&gt;...</span>
</pre></div>
</div>
</div>
<div class="section" id="write">
<h3>write<a class="headerlink" href="#write" title="Permalink to this headline">¶</a></h3>
<p>Create and Write a file.</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">write</span> <span class="o">&lt;</span><span class="n">file_name</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="n">Enter</span> <span class="n">Data</span><span class="o">&gt;</span>
<span class="n">Ctrl</span><span class="o">+</span><span class="n">D</span> <span class="n">Exit</span><span class="o">.</span>
</pre></div>
</div>
</div>
<div class="section" id="lls">
<h3>lls<a class="headerlink" href="#lls" title="Permalink to this headline">¶</a></h3>
<p>Lists all files and directories in the specified directory.Current local directory files and directories are listed if no     path is mentioned</p>
<p>Usage:</p>
<blockquote>
<div><p>lls &lt;path&gt;…..</p>
</div></blockquote>
</div>
<div class="section" id="lcd">
<h3>lcd<a class="headerlink" href="#lcd" title="Permalink to this headline">¶</a></h3>
<p>Moves into the given local directory.</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">lcd</span> <span class="o">&lt;</span><span class="n">path</span><span class="o">&gt;</span>
</pre></div>
</div>
</div>
<div class="section" id="lpwd">
<h3>lpwd<a class="headerlink" href="#lpwd" title="Permalink to this headline">¶</a></h3>
<p>Prints the absolute path of the current local directory.</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">lpwd</span>
</pre></div>
</div>
</div>
<div class="section" id="umask">
<h3>umask<a class="headerlink" href="#umask" title="Permalink to this headline">¶</a></h3>
<p>Set and get the file mode creation mask</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">umask</span> <span class="p">[</span><span class="n">mode</span><span class="p">]</span>
</pre></div>
</div>
</div>
<div class="section" id="alias">
<h3>alias<a class="headerlink" href="#alias" title="Permalink to this headline">¶</a></h3>
<p>Define or display aliases</p>
<p>Usage:</p>
<blockquote>
<div><p>alias [name] | [&lt;name&gt; &lt;value&gt;]</p>
</div></blockquote>
<ul class="simple">
<li><p>name - name of the alias being looked up, added, or replaced</p></li>
<li><p>value - what the alias will be resolved to (if adding or replacing) this can contain spaces and does not need to be quoted</p></li>
</ul>
</div>
<div class="section" id="run-pyscript">
<h3>run_pyscript<a class="headerlink" href="#run-pyscript" title="Permalink to this headline">¶</a></h3>
<p>Runs a python script file inside the console</p>
<p>Usage:</p>
<blockquote>
<div><p>run_pyscript &lt;script_path&gt; [script_arguments]</p>
</div></blockquote>
<ul class="simple">
<li><p>Console commands can be executed inside this script with cmd (“your command”)
However, you cannot run nested “py” or “pyscript” commands from within this
script. Paths or arguments that contain spaces must be enclosed in quotes</p></li>
</ul>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This command is available as <code class="docutils literal notranslate"><span class="pre">pyscript</span></code> for cmd2 versions 0.9.13
or less.</p>
</div>
</div>
<div class="section" id="py">
<h3>py<a class="headerlink" href="#py" title="Permalink to this headline">¶</a></h3>
<p>Invoke python command, shell, or script</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">py</span> <span class="o">&lt;</span><span class="n">command</span><span class="o">&gt;</span><span class="p">:</span> <span class="n">Executes</span> <span class="n">a</span> <span class="n">Python</span> <span class="n">command</span><span class="o">.</span>
<span class="n">py</span><span class="p">:</span> <span class="n">Enters</span> <span class="n">interactive</span> <span class="n">Python</span> <span class="n">mode</span><span class="o">.</span>
</pre></div>
</div>
</div>
<div class="section" id="shortcuts">
<h3>shortcuts<a class="headerlink" href="#shortcuts" title="Permalink to this headline">¶</a></h3>
<p>Lists shortcuts (aliases) available</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">shortcuts</span>
</pre></div>
</div>
</div>
<div class="section" id="history">
<h3>history<a class="headerlink" href="#history" title="Permalink to this headline">¶</a></h3>
<p>View, run, edit, and save previously entered commands.</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">history</span> <span class="p">[</span><span class="o">-</span><span class="n">h</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">r</span> <span class="o">|</span> <span class="o">-</span><span class="n">e</span> <span class="o">|</span> <span class="o">-</span><span class="n">s</span> <span class="o">|</span> <span class="o">-</span><span class="n">o</span> <span class="n">FILE</span> <span class="o">|</span> <span class="o">-</span><span class="n">t</span> <span class="n">TRANSCRIPT</span><span class="p">]</span> <span class="p">[</span><span class="n">arg</span><span class="p">]</span>
</pre></div>
</div>
<dl>
<dt>选项：</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-h</span></kbd></dt>
<dd><p>show this help message and exit</p>
</dd>
<dt><kbd><span class="option">-r</span></kbd></dt>
<dd><p>run selected history items</p>
</dd>
<dt><kbd><span class="option">-e</span></kbd></dt>
<dd><p>edit and then run selected history items</p>
</dd>
<dt><kbd><span class="option">-s</span></kbd></dt>
<dd><p>script format; no separation lines</p>
</dd>
<dt><kbd><span class="option">-o <var>FILE</var></span></kbd></dt>
<dd><p>output commands to a script file</p>
</dd>
<dt><kbd><span class="option">-t <var>TRANSCRIPT</var></span></kbd></dt>
<dd><p>output commands and results to a transcript file</p>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="unalias">
<h3>unalias<a class="headerlink" href="#unalias" title="Permalink to this headline">¶</a></h3>
<p>Unsets aliases</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">unalias</span> <span class="p">[</span><span class="o">-</span><span class="n">a</span><span class="p">]</span> <span class="n">name</span> <span class="p">[</span><span class="n">name</span> <span class="o">...</span><span class="p">]</span>
</pre></div>
</div>
<ul class="simple">
<li><p>name - name of the alias being unset</p></li>
</ul>
<dl>
<dt>选项：</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-a</span></kbd></dt>
<dd><p>remove all alias definitions</p>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="set">
<h3>set<a class="headerlink" href="#set" title="Permalink to this headline">¶</a></h3>
<p>Sets a settable parameter or shows current settings of parameters.</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="nb">set</span> <span class="p">[</span><span class="o">-</span><span class="n">h</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">a</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">l</span><span class="p">]</span> <span class="p">[</span><span class="n">settable</span> <span class="p">[</span><span class="n">settable</span> <span class="o">...</span><span class="p">]]</span>
</pre></div>
</div>
<ul class="simple">
<li><p>Call without arguments for a list of settable parameters with their values.</p></li>
</ul>
<dl>
<dt>选项：</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-h</span></kbd></dt>
<dd><p>show this help message and exit</p>
</dd>
<dt><kbd><span class="option">-a</span></kbd></dt>
<dd><p>display read-only settings as well</p>
</dd>
<dt><kbd><span class="option">-l</span></kbd></dt>
<dd><p>describe function of parameter</p>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="edit">
<h3>edit<a class="headerlink" href="#edit" title="Permalink to this headline">¶</a></h3>
<p>Edit a file in a text editor.</p>
<p>Usage:</p>
<blockquote>
<div><p>edit [file_path]</p>
</div></blockquote>
<ul class="simple">
<li><p>file_path - path to a file to open in editor</p></li>
</ul>
</div>
<div class="section" id="run-script">
<h3>run_script<a class="headerlink" href="#run-script" title="Permalink to this headline">¶</a></h3>
<p>Runs commands in script file that is encoded as either ASCII or UTF-8 text.
Each command in the script should be separated by a newline.</p>
<p>Usage:</p>
<blockquote>
<div><p>run_script &lt;file_path&gt;</p>
</div></blockquote>
<ul class="simple">
<li><p>file_path - a file path pointing to a script</p></li>
</ul>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This command is available as <code class="docutils literal notranslate"><span class="pre">load</span></code> for cmd2 versions 0.9.13
or less.</p>
</div>
</div>
<div class="section" id="shell">
<h3>shell<a class="headerlink" href="#shell" title="Permalink to this headline">¶</a></h3>
<p>Execute a command as if at the OS prompt.</p>
<p>Usage:</p>
<blockquote>
<div><p>shell &lt;command&gt; [arguments]</p>
</div></blockquote>
</div>
<div class="section" id="locate">
<h3>locate<a class="headerlink" href="#locate" title="Permalink to this headline">¶</a></h3>
<p>Find an item in File System</p>
<p>Usage:</p>
<blockquote>
<div><p>locate [options] &lt;name&gt;</p>
</div></blockquote>
<dl>
<dt>选项：</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-c</span></kbd></dt>
<dd><p>Count number of items found</p>
</dd>
<dt><kbd><span class="option">-i</span></kbd></dt>
<dd><p>Ignore case</p>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="stat">
<h3>stat<a class="headerlink" href="#stat" title="Permalink to this headline">¶</a></h3>
<p>Display file status.</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">stat</span> <span class="p">[</span><span class="o">-</span><span class="n">h</span><span class="p">]</span> <span class="o">&lt;</span><span class="n">file_name</span><span class="o">&gt;</span> <span class="p">[</span><span class="n">file_name</span> <span class="o">...</span><span class="p">]</span>
</pre></div>
</div>
<dl>
<dt>选项：</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-h</span></kbd></dt>
<dd><p>Shows the help message</p>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="snap">
<h3>snap<a class="headerlink" href="#snap" title="Permalink to this headline">¶</a></h3>
<p>Create or Delete Snapshot</p>
<p>Usage:</p>
<blockquote>
<div><p>snap {create|delete} &lt;snap_name&gt; &lt;dir_name&gt;</p>
</div></blockquote>
<ul class="simple">
<li><p>snap_name - Snapshot name to be created or deleted</p></li>
<li><p>dir_name - directory under which snapshot should be created or deleted</p></li>
</ul>
</div>
<div class="section" id="setxattr">
<h3>setxattr<a class="headerlink" href="#setxattr" title="Permalink to this headline">¶</a></h3>
<p>Set extended attribute for a file</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">setxattr</span> <span class="p">[</span><span class="o">-</span><span class="n">h</span><span class="p">]</span> <span class="o">&lt;</span><span class="n">path</span><span class="o">&gt;</span> <span class="o">&lt;</span><span class="n">name</span><span class="o">&gt;</span> <span class="o">&lt;</span><span class="n">value</span><span class="o">&gt;</span>
</pre></div>
</div>
<ul class="simple">
<li><p>path - Path to the file</p></li>
<li><p>name - Extended attribute name to get or set</p></li>
<li><p>value - Extended attribute value to be set</p></li>
</ul>
<dl>
<dt>选项：</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></dt>
<dd><p>Shows the help message</p>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="getxattr">
<h3>getxattr<a class="headerlink" href="#getxattr" title="Permalink to this headline">¶</a></h3>
<p>Get extended attribute value for the name associated with the path</p>
<p>用法：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">getxattr</span> <span class="p">[</span><span class="o">-</span><span class="n">h</span><span class="p">]</span> <span class="o">&lt;</span><span class="n">path</span><span class="o">&gt;</span> <span class="o">&lt;</span><span class="n">name</span><span class="o">&gt;</span>
</pre></div>
</div>
<ul class="simple">
<li><p>path - Path to the file</p></li>
<li><p>name - Extended attribute name to get or set</p></li>
</ul>
<dl>
<dt>选项：</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></dt>
<dd><p>Shows the help message</p>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="listxattr">
<h3>listxattr<a class="headerlink" href="#listxattr" title="Permalink to this headline">¶</a></h3>
<p>List extended attribute names associated with the path</p>
<p>用法：</p>
<blockquote>
<div><p>listxattr [-h] &lt;path&gt;</p>
</div></blockquote>
<ul class="simple">
<li><p>path - Path to the file</p></li>
</ul>
<dl>
<dt>选项：</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></dt>
<dd><p>Shows the help message</p>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="df">
<h3>df<a class="headerlink" href="#df" title="Permalink to this headline">¶</a></h3>
<p>Display amount of available disk space</p>
<p>Usage :</p>
<blockquote>
<div><p>df [-h] [file [file …]]</p>
</div></blockquote>
<ul class="simple">
<li><p>file - name of the file</p></li>
</ul>
<dl>
<dt>Options:</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></dt>
<dd><p>Shows the help message</p>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="du">
<h3>du<a class="headerlink" href="#du" title="Permalink to this headline">¶</a></h3>
<p>Show disk usage of a directory</p>
<p>Usage :</p>
<blockquote>
<div><p>du [-h] [-r] [paths [paths …]]</p>
</div></blockquote>
<ul class="simple">
<li><p>paths - name of the directory</p></li>
</ul>
<dl>
<dt>Options:</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></dt>
<dd><p>Shows the help message</p>
</dd>
<dt><kbd><span class="option">-r</span></kbd></dt>
<dd><p>Recursive Disk usage of all directories</p>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="quota">
<h3>quota<a class="headerlink" href="#quota" title="Permalink to this headline">¶</a></h3>
<p>Quota management for a Directory</p>
<p>Usage :</p>
<blockquote>
<div><p>quota [-h] [–max_bytes [MAX_BYTES]] [–max_files [MAX_FILES]] {get,set} path</p>
</div></blockquote>
<ul class="simple">
<li><p>{get,set} - quota operation type.</p></li>
<li><p>path - name of the directory.</p></li>
</ul>
<dl>
<dt>Options :</dt><dd><dl class="option-list">
<dt><kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></dt>
<dd><p>Shows the help message</p>
</dd>
<dt><kbd><span class="option">--max_bytes <var>MAX_BYTES</var></span></kbd></dt>
<dd><p>Set max cumulative size of the data under this directory</p>
</dd>
<dt><kbd><span class="option">--max_files <var>MAX_FILES</var></span></kbd></dt>
<dd><p>Set total number of files under this directory tree</p>
</dd>
</dl>
</dd>
</dl>
</div>
</div>
<div class="section" id="exit-code">
<h2>Exit Code<a class="headerlink" href="#exit-code" title="Permalink to this headline">¶</a></h2>
<p>Following exit codes are returned by cephfs shell</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 81%" />
<col style="width: 19%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Error Type</p></th>
<th class="head"><p>Exit Code</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Miscellaneous</p></td>
<td><p>1</p></td>
</tr>
<tr class="row-odd"><td><p>Keyboard Interrupt</p></td>
<td><p>2</p></td>
</tr>
<tr class="row-even"><td><p>Operation not permitted</p></td>
<td><p>3</p></td>
</tr>
<tr class="row-odd"><td><p>Permission denied</p></td>
<td><p>4</p></td>
</tr>
<tr class="row-even"><td><p>No such file or directory</p></td>
<td><p>5</p></td>
</tr>
<tr class="row-odd"><td><p>I/O error</p></td>
<td><p>6</p></td>
</tr>
<tr class="row-even"><td><p>No space left on device</p></td>
<td><p>7</p></td>
</tr>
<tr class="row-odd"><td><p>File exists</p></td>
<td><p>8</p></td>
</tr>
<tr class="row-even"><td><p>No data available</p></td>
<td><p>9</p></td>
</tr>
<tr class="row-odd"><td><p>Invalid argument</p></td>
<td><p>10</p></td>
</tr>
<tr class="row-even"><td><p>Operation not supported on transport endpoint</p></td>
<td><p>11</p></td>
</tr>
<tr class="row-odd"><td><p>Range error</p></td>
<td><p>12</p></td>
</tr>
<tr class="row-even"><td><p>Operation would block</p></td>
<td><p>13</p></td>
</tr>
<tr class="row-odd"><td><p>Directory not empty</p></td>
<td><p>14</p></td>
</tr>
<tr class="row-even"><td><p>Not a directory</p></td>
<td><p>15</p></td>
</tr>
<tr class="row-odd"><td><p>Disk quota exceeded</p></td>
<td><p>16</p></td>
</tr>
<tr class="row-even"><td><p>Broken pipe</p></td>
<td><p>17</p></td>
</tr>
<tr class="row-odd"><td><p>Cannot send after transport endpoint shutdown</p></td>
<td><p>18</p></td>
</tr>
<tr class="row-even"><td><p>Connection aborted</p></td>
<td><p>19</p></td>
</tr>
<tr class="row-odd"><td><p>Connection refused</p></td>
<td><p>20</p></td>
</tr>
<tr class="row-even"><td><p>Connection reset</p></td>
<td><p>21</p></td>
</tr>
<tr class="row-odd"><td><p>Interrupted function call</p></td>
<td><p>22</p></td>
</tr>
</tbody>
</table>
</div>
</div>



           </div>
           
          </div>
          <footer>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>